package com.itheima.set;

import com.itheima.domain.Student;

import java.util.HashSet;
import java.util.TreeSet;


//HashSet  能不能去重? 能  靠的是哈希值
//哈希值 相同就不要了吗?


public class Demo02 {

    public static void main(String[] args) {

        HashSet<Student> set = new HashSet<>();
      /*  Student lu1 = new Student("鹿晗1", 30);
        set.add(lu1);
        Student lu2 = new Student("鹿晗1", 30);
        set.add(lu2);
        System.out.println(lu1.hashCode());
       System.out.println(lu2.hashCode());*/

       /* lu1.setName("签签");
        lu1.setAge(35);
        set.add(lu1);*/
        //System.out.println(lu1.hashCode());

        Student student1 = new Student("鹿晗", 1, 100);

        set.add(student1);
        System.out.println(student1.hashCode());
        Student student2=student1;
        student2.setName("签签");
        student2.setAge(10);
        student2.setScore(10);
        System.out.println(student2.hashCode());
        set.add(student2);
        System.out.println(set);
    }
}
